(function(window){
    function Toast(type,content,padding){
        let wrap = document.createElement('div');
        wrap.classList.add('kh_zz');
        let content_wrap = document.createElement('div');
        content_wrap.classList.add('kh_content');
        if(padding){
            if(typeof padding == 'number'){
                content_wrap.style['--padding'] = padding + 'px';
            }else{
                content_wrap.style['--padding'] = padding;
            }
        }
        let icondiv = document.createElement('div');
        icondiv.classList.add('iconfont');
        icondiv.classList.add('kh_icon');
        if(type == 'success'){
            icondiv.classList.add('icon-chenggong');
            icondiv.style.color = 'rgb(82, 196, 26)';
        }else if(type == 'warning'){
            icondiv.classList.add('icon-icon--jinggao');
            icondiv.style.color = 'rgb(255, 142, 20)';
        }else if(type == 'fail'){
            icondiv.classList.add('icon-shibai');
            icondiv.style.color = '#E84335';
        }
        content_wrap.appendChild(icondiv);
        let msgdiv = document.createElement('div');
        msgdiv.innerHTML =`<p></p>${content}<p>
        <div class='kh_btu'>确定</div>                    
        `;
        content_wrap.appendChild(msgdiv);
        document.body.appendChild(wrap);
        wrap.appendChild(content_wrap)
       
        wrap.addEventListener('click',function(e){
            if(e.target != content_wrap){
                wrap.style.display = 'none';
            }
        })
        
    }
    window.Toast = Toast;
}(window))